package com.example.bloodbankproject;

import com.urbanairship.push.PushManager;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.provider.Settings.Secure;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.TextView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;

public class ModulesActivity extends Activity {

	private ListView mListview;
	public static String apidString="";
	public static String deviceID="";
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.modules);
		
		deviceID = Secure.getString(this.getContentResolver(),
	                Secure.ANDROID_ID);

		mListview = (ListView) findViewById(R.id.listview);

		mListview.setOnItemClickListener(new OnItemClickListener() {

			@Override
			public void onItemClick(AdapterView<?> arg0, View v, int arg2,
					long arg3) {

				String item = ((TextView) v).getText().toString();
				Log.i("NCS", item + "item click");

				if (item.equalsIgnoreCase("home")) {
					//logic for to navigate to home
					startActivity(new Intent(getApplicationContext(),HomeActivity.class));
				}
				if (item.equalsIgnoreCase("About Us")) {

					//logic for to navigate to About Us
					startActivity(new Intent(getApplicationContext(),AboutUsActivity.class));
				}
				if (item.equalsIgnoreCase("Donar Registration")) {
					//logic for to navigate to Donar Registration
					startActivity(new Intent(getApplicationContext(),DonorRegistration.class));
				}
				if (item.equalsIgnoreCase("Request Friend")) {
					//logic for to navigate to Request Friend
					startActivity(new Intent(getApplicationContext(),RequestFriendActivity.class));
				}
				if (item.equalsIgnoreCase("Search Donars")) {
					//logic for to navigate to Search Donars
					startActivity(new Intent(getApplicationContext(),SearchDonorActivity.class));
				}
				if (item.equalsIgnoreCase("Request Blood")) {
					//logic for to navigate to Request Blood
					startActivity(new Intent(getApplicationContext(),RequestBloodActivity.class));
				}
				if (item.equalsIgnoreCase("Contact Us")) {
					//logic for to navigate to Contact Us
					startActivity(new Intent(getApplicationContext(),ContactUsActivity.class));
				}
				if(item.equalsIgnoreCase("Recent Updates")){
					startActivity(new Intent(getApplicationContext(),RecentUpdatesActivity.class));
				}

			}
		});

	}
	
	@Override
	protected void onResume() {
		try{
		apidString = PushManager.shared().getAPID();
		Log.i("NCS","AppID is  :"+apidString);
		}catch(Exception ex){
			
		}
		super.onResume();
	}

}
